package com.leyou.item.pojo.api;

import com.leyou.item.pojo.SpecGroup;
import com.leyou.item.pojo.SpecParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("spec")
public interface SpecApi {

    @GetMapping("groups/{cid}")
    public ResponseEntity<List<SpecGroup>> querySpecGroupByCid(@PathVariable("cid") Long cid);

    @GetMapping("params")
    public List<SpecParam> querySpecParamByGid(
            @RequestParam(value = "gid", required = false) Long gid,
            @RequestParam(value = "cid", required = false) Long cid,
            @RequestParam(value = "searching", required = false) Boolean searching,
            @RequestParam(value = "generic", required = false) Boolean generic
    );

    @PostMapping("group")
    public ResponseEntity<String> addSpecGroup(SpecGroup group);

    @PutMapping("group")
    public ResponseEntity<String> updateSpecGroup(SpecGroup group);

    @DeleteMapping("group/{id}")
    public ResponseEntity<String> deleteSpecGroupById(@PathVariable("id") Long id);

    @PostMapping("param")
    public ResponseEntity<String> addSpecParam(SpecParam param);

    @PutMapping("param")
    public ResponseEntity<String> updateSpecParam(SpecParam param);

    @DeleteMapping("param/{id}")
    public ResponseEntity<String> deleteSpecParamById(@PathVariable("id") Long id);

    @GetMapping("{id}")
    List<SpecGroup> querySpecsByCid(@PathVariable("id") Long cid);


}
